package com.feihong.txgw.tx_precenter;

import com.feihong.txgw.inter.contract.product.IHotSearchContract;
import com.feihong.txgw.model.bean.user.HotSearchDataModel;
import com.feihong.txgw.tx_model.HotSearchMainModel;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * @Author wangziheng
 * @ProjectName txgw_app
 * @ClassName HotSearchMainPrecenter
 * @package com.feihong.txgw.tx_precenter
 * @data 2018/5/8 10:59
 * @Describe
 * @Change
 */
public class HotSearchMainPrecenter extends IHotSearchContract.AbHotSearchMainPrecenter {
    @Override
    public void getHotSearchGoods() {
        mIModel.getHotSerachGoods().subscribe(new Observer<HotSearchDataModel>() {
            @Override
            public void onSubscribe(Disposable d) {
                mRxManager.register(d);
            }

            @Override
            public void onNext(HotSearchDataModel hotSearchDataModel) {
                mIView.hotSearchList(hotSearchDataModel);
            }

            @Override
            public void onError(Throwable e) {
                mIView.loadDataError();
            }

            @Override
            public void onComplete() {

            }
        });
    }

    public static HotSearchMainPrecenter create(){
        return new HotSearchMainPrecenter();
    }
    @Override
    public IHotSearchContract.IHotSearchMainModel getModel() {
        return HotSearchMainModel.create();
    }

    @Override
    public void onStart() {

    }
}
